import { defineStore } from 'pinia'

export default defineStore('main', {
  state: () => {
    return {
      num: 0, // 定义一个num变量
      name: 'zhansan',
    }
  },
  getters: {
    nameLength: (state) => state.name.length,
  },
  actions: {
    changeNum(state) {
      console.log(state)
      this.num++
    },
    changeName(payload) {
      this.name = payload
    },
  },
})
